is_admin
This function checks whether the game is being run with administrator privileges.
bool is_admin()
Parameters:
None.
Return value:
true if the game is being run with administrator privileges, false otherwise.
Remarks:
Many users of Windows XP and earlier tended to run as administrators all the time. This opened up a lot of security issues that virus makers could exploit. Therefore, with Windows Vista and above Microsoft made the user rights management a lot more prominent in the operating system. One example of this is the inclusion of UAC (user access control), which advises users when programs attempt to do things that could be considered harmful such as writing to certain directories on the file system. With this function you may check if the current user is running as an administrator, or alternatively if they have enabled administrative privileges for your process specifically.
Example:
void main()
{
if(is_admin())
{
alert("Congratulations", "You are an administrator!");
}
else
{
alert("Sorry", "You don't appear to be privileged enough to be an administrator on this system.");
}
}